package org.openwork.portlet.skillmanagement.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.util.PortalUtil;

import org.openwork.portlet.skillmanagement.service.persistence.SkillUserPK;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.util.Date;


public class SkillUserClp extends BaseModelImpl<SkillUser> implements SkillUser {
    private long _userId;
    private String _userUuid;
    private long _skillId;
    private long _auditUserId;
    private String _auditUserUuid;
    private Date _createDate;
    private Date _modifiedDate;
    private Short _experience;

    public SkillUserClp() {
    }

    public SkillUserPK getPrimaryKey() {
        return new SkillUserPK(_userId, _skillId);
    }

    public void setPrimaryKey(SkillUserPK pk) {
        setUserId(pk.userId);
        setSkillId(pk.skillId);
    }

    public Serializable getPrimaryKeyObj() {
        return new SkillUserPK(_userId, _skillId);
    }

    public long getUserId() {
        return _userId;
    }

    public void setUserId(long userId) {
        _userId = userId;
    }

    public String getUserUuid() throws SystemException {
        return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
    }

    public void setUserUuid(String userUuid) {
        _userUuid = userUuid;
    }

    public long getSkillId() {
        return _skillId;
    }

    public void setSkillId(long skillId) {
        _skillId = skillId;
    }

    public long getAuditUserId() {
        return _auditUserId;
    }

    public void setAuditUserId(long auditUserId) {
        _auditUserId = auditUserId;
    }

    public String getAuditUserUuid() throws SystemException {
        return PortalUtil.getUserValue(getAuditUserId(), "uuid", _auditUserUuid);
    }

    public void setAuditUserUuid(String auditUserUuid) {
        _auditUserUuid = auditUserUuid;
    }

    public Date getCreateDate() {
        return _createDate;
    }

    public void setCreateDate(Date createDate) {
        _createDate = createDate;
    }

    public Date getModifiedDate() {
        return _modifiedDate;
    }

    public void setModifiedDate(Date modifiedDate) {
        _modifiedDate = modifiedDate;
    }

    public Short getExperience() {
        return _experience;
    }

    public void setExperience(Short experience) {
        _experience = experience;
    }

    public org.openwork.portlet.skillmanagement.model.Skill getSkill() {
        throw new UnsupportedOperationException();
    }

    public com.liferay.portal.model.User getUser() {
        throw new UnsupportedOperationException();
    }

    public SkillUser toEscapedModel() {
        if (isEscapedModel()) {
            return this;
        } else {
            return (SkillUser) Proxy.newProxyInstance(SkillUser.class.getClassLoader(),
                new Class[] { SkillUser.class }, new AutoEscapeBeanHandler(this));
        }
    }

    public Object clone() {
        SkillUserClp clone = new SkillUserClp();

        clone.setUserId(getUserId());
        clone.setSkillId(getSkillId());
        clone.setAuditUserId(getAuditUserId());
        clone.setCreateDate(getCreateDate());
        clone.setModifiedDate(getModifiedDate());
        clone.setExperience(getExperience());

        return clone;
    }

    public int compareTo(SkillUser skillUser) {
        SkillUserPK pk = skillUser.getPrimaryKey();

        return getPrimaryKey().compareTo(pk);
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        SkillUserClp skillUser = null;

        try {
            skillUser = (SkillUserClp) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        SkillUserPK pk = skillUser.getPrimaryKey();

        if (getPrimaryKey().equals(pk)) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return getPrimaryKey().hashCode();
    }

    public String toString() {
        StringBundler sb = new StringBundler(13);

        sb.append("{userId=");
        sb.append(getUserId());
        sb.append(", skillId=");
        sb.append(getSkillId());
        sb.append(", auditUserId=");
        sb.append(getAuditUserId());
        sb.append(", createDate=");
        sb.append(getCreateDate());
        sb.append(", modifiedDate=");
        sb.append(getModifiedDate());
        sb.append(", experience=");
        sb.append(getExperience());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBundler sb = new StringBundler(22);

        sb.append("<model><model-name>");
        sb.append("org.openwork.portlet.skillmanagement.model.SkillUser");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>userId</column-name><column-value><![CDATA[");
        sb.append(getUserId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>skillId</column-name><column-value><![CDATA[");
        sb.append(getSkillId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>auditUserId</column-name><column-value><![CDATA[");
        sb.append(getAuditUserId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>createDate</column-name><column-value><![CDATA[");
        sb.append(getCreateDate());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
        sb.append(getModifiedDate());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>experience</column-name><column-value><![CDATA[");
        sb.append(getExperience());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
